package com.thlws.study.kafka.boot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @author HanleyTang 2019-08-14
 */
@Configuration
public class LogBoot implements ApplicationRunner {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void run(ApplicationArguments args) throws Exception {
        for (int i = 0; i < 5; i++) {
            logger.info("测试 info 基本的日志信息，{}",i);
            if (i % 3 == 0) {
                logger.info("测试 warn 基本的日志信息，{}",i);
            }

            if (i % 8 == 0) {
                logger.info("测试 error 基本的日志信息，{}",i);
            }
            TimeUnit.MILLISECONDS.sleep(200);
        }
    }
}
